package com.mao.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/*
user：mao
data：2021/6/14
note：
*/
@Controller
public class AccountController {

    @RequestMapping("/upFile")
    public String getUploadFileForm(){
        System.out.println("in the getUploadFileForm");
        //使用模板引擎即
        //1.添加thymeleaf依赖，2,将静态模板文件放置在templates下面。
        return "uploadfileForm";
    }

    @RequestMapping("/getUploadFile")
    @ResponseBody
    public String getUploadFile(MultipartFile file ) throws IOException {
        System.out.println("MutlipartFile"+file);
        file.transferTo(new File("e:\\"+file.getOriginalFilename()));
        System.out.println(file.getOriginalFilename());
        return "OK";
    }

    @RequestMapping("/rsv")
//    @ResponseBody
    public String asa(){

        System.out.println("aa");

        return "aa";
    }
}
